<div class="f-cb f-mb10"><h3 class="list-title">score数据</h3> <span class="f-fr"><a href="#!/?score/admin/score/addItem" class="f-btn f-btn-success">增加数据</a></span></div>
<div class="mkoa-box f-p10"  ms-controller="score-list">
    <mkoa:pager  url="score/admin/score/findAll" searchurl="score/admin/score/search" >
        <div slot="$top" id="search">
            <select ms-duplex="searchKey" class="f-fl" >
                <option value="id">ID</option>
                <option value="mid">用户ID</option><option value="cid">课堂ID</option><option value="score">分数</option><option value="person">打分对象</option>
            </select>
            <input type="text" ms-duplex="searchValue" class="f-fl f-ml5"/>
            <button ms-click="search" class="f-btn f-btn-success f-ml10" >搜索</button>
            <button ms-if="searchOpen" ms-click="closeSearch" class="f-btn">清空搜索</button>
        </div>
        <table slot="$list" class="mkoa-table">
            <thead>
            <tr><th width="30">ID</th><th>用户ID</th><th>课堂ID</th><th>分数</th><th>打分对象</th><th width="155">创建时间</th><th width="100">操作</th></tr>
            </thead>
            <tbody>
            <tr ms-repeat="listData"><td>{{el.id}}</td><td>{{el.mid}}</td><td>{{el.cid}}</td><td>{{el.score}}</td><td>{{el.person}}</td><td>{{el.createdAt|date("yyyy-MM-dd HH:mm:ss")}}</td>
           <td><a ms-attr-href="'#!/?score/admin/score/addItem?id='+el.id"  class="f-btn f-btn-sm">编辑</a> <button  ms-click="remove($remove,el.id)" class="f-btn f-btn-sm">删除</button></td>
            </tr>
            </tbody>
        </table>
    </mkoa:pager>
</div>
<script>
    require(["mkoaAjax/mkoaAjax","mkoaPagerFull/mkoaPagerFull"], function ($a){
       avalon.define({
            $id:'score-list',
            remove:function($remove,id){
                $a.getJSON(app.$host +'score/admin/score/delete',{id:id},function(data){//删除数据
                    if(!data.error){
                        $remove();
                    }
                });
            }
        });
        avalon.scan();
    });
</script>